#ifndef OBJECTEDITORMODE_H
#define OBJECTEDITORMODE_H

#include "editormode.h"

class EditorView;
class AbstractGameObject;
namespace ObjectEditors { class EditorManager; }

namespace Modes {

class ObjectEditorMode : public EditorMode
{
	Q_OBJECT
	friend class EditorModeManager;
public:
	ObjectEditorMode(EditorModeManager& em);

	void enter();
	void exit();
	void updateGui();

	QPointer<AbstractGameObject> selectedGameObject() const;
	QPointer<ObjectEditors::EditorManager> editorManager() const;
private:
	void onDocumentChanged(QPointer<Document> doc);
	QPointer<AbstractGameObject> m_selectedObject;
	QPointer<ObjectEditors::EditorManager> m_editorManager;
	// GUI
	void initDocks();
	void initActions();
	void initObjectToolbar();
	void createConnections();
	QPointer<EditorView> m_editorView;
	QPointer<QDockWidget> m_gameObjectsDock;
	QPointer<QDockWidget> m_objectPropertiesDock;

	QPointer<QMenu> m_objectMenu;
	QPointer<QAction> m_addActorAct;
	QPointer<QAction> m_addVisualObjectAct;
	QPointer<QAction> m_addPhysicsAct;

	QPointer<QToolBar> m_objectToolbar;
signals:
	// to notify gui (e.g. for changing property page)
	void selectedObjectChanged(QPointer<AbstractGameObject> go);
public slots:
	// notification from tree widget
	void onSelectedObjectChanged(QPointer<AbstractGameObject> gameObject);
private slots:
	void onAddActor();
	void onAddVisualObject();
	void onAddPhysics();
};

} // namespace Modes

#endif // OBJECTEDITORMODE_H
